package com.koron.housing.info.controller;


import com.github.pagehelper.PageInfo;
import com.koron.bean.base.Response;
import com.koron.bean.query.PageQuery;
import com.koron.common.core.config.ThreadLocalContext;
import com.koron.housing.info.bean.po.HousingRecord;
import com.koron.housing.info.bean.query.HousingRecordQuery;
import com.koron.housing.info.service.HousingRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 租房记录(HousingRecord)表控制层
 *
 * @author jzp
 * @since 2022-02-26 11:04:10
 */
@Api(tags = "租房记录接口")
@RestController
@RequestMapping("housingRecord")
public class HousingRecordController {
    /**
     * 服务对象
     */
    @Autowired
    private HousingRecordService housingRecordService;

    private String getCurrDs() {
        return ThreadLocalContext.get().getCurrDs();
    }


    @ApiOperation(value = "分页查询")
    @GetMapping("page")
    public Response<PageInfo<HousingRecord>> page(PageQuery pageQuery, HousingRecordQuery query) {
        return Response.ok(ADOConnection.runTask(getCurrDs(), housingRecordService, "page", PageInfo.class, pageQuery, query));
    }

}
